package com.example.auth.demo.service;

import com.example.auth.demo.domain.PageResult;
import com.example.auth.demo.domain.auth.ResponseUserToken;
import com.example.auth.demo.domain.auth.Role;
import com.example.auth.demo.domain.auth.UserDetail;
import com.example.auth.demo.domain.auth.Equipment;
import com.example.auth.demo.domain.auth.Task;
import com.example.auth.demo.domain.auth.Player;
import com.example.auth.demo.domain.auth.PlayerFeedback;


import com.example.auth.demo.domain.auth.Guild;
import com.example.auth.demo.domain.auth.GuildActivity;
import com.example.auth.demo.domain.auth.GuildActivityParticipant;
import com.example.auth.demo.domain.auth.GuildChat;
import com.example.auth.demo.domain.auth.GuildContribution;
import com.example.auth.demo.domain.auth.GuildDiplomacy;
import com.example.auth.demo.domain.auth.GuildMember;
import com.example.auth.demo.domain.auth.GuildNotice;
import com.github.pagehelper.PageInfo;

import java.util.List;


public interface AuthService {


    List<UserDetail> getAllUsers();
    PageResult<UserDetail> getAllUsersByPage(int page, int pageSize);
    /**
     * 注册用户
     * @param userDetail
     * @return
     */
    UserDetail register(UserDetail userDetail);

    /**
     * 登陆
     * @param username
     * @param password
     * @return
     */
    ResponseUserToken login(String username, String password);

    /**
     * 登出
     * @param token
     */
    void logout(String token);

    /**
     * 刷新Token
     * @param oldToken
     * @return
     */
    ResponseUserToken refresh(String oldToken);

    /**
     * 根据Token获取用户信息
     * @param token
     * @return
     */
    UserDetail getUserByToken(String token);

    /**
     * 创建角色
     * @param role
     */
    void createRole(Role role);

    /**
     * 修改角色信息
     * @param role
     */
    void updateRole(Role role);

    /**
     * 删除角色
     * @param roleId
     */
    void deleteRole(long roleId);

    /**
     * 获取所有角色
     * @return
     */
    PageResult<Role> getAllRoles(int page, int pageSize);


    /**
     * 创建装备
     * @param equipment 装备信息
     */
    void createEquipment(Equipment equipment);

    /**
     * 添加装备到角色
     * @param roleId 角色ID
     * @param equipmentId 装备ID
     */
    void addEquipmentToRole(long roleId, long equipmentId);

    /**
     * 从角色移除装备
     * @param roleId 角色ID
     * @param equipmentId 装备ID
     */
    void removeEquipmentFromRole(long roleId, long equipmentId);

    /**
     * 获取角色的所有装备
     * @param roleId 角色ID
     * @return 装备列表
     */
    List<Equipment> getRoleEquipments(long roleId);

    /**
     * 根据ID获取装备
     * @param equipmentId 装备ID
     * @return 装备信息
     */
    Equipment getEquipmentById(long equipmentId);

    // 获取所有装备列表
    PageResult<Equipment> getAllEquipments(int page, int pageSize);

    // 更新装备信息
    void updateEquipment(Equipment equipment);

    /**
     * 创建任务
     * @param task 任务信息
     */
    void createTask(Task task);

    /**
     * 为角色分配任务
     * @param roleId 角色 ID
     * @param taskId 任务 ID
     */
    void assignTaskToRole(long roleId, long taskId);

    /**
     * 标记角色的任务为已完成
     * @param roleId 角色 ID
     * @param taskId 任务 ID
     */
    void markTaskAsCompleted(long roleId, long taskId);

    /**
     * 获取角色的所有任务
     * @param roleId 角色 ID
     * @return 任务列表
     */
    List<Task> getRoleTasks(long roleId);

    /**
     * 获取角色未完成的任务
     * @param roleId 角色 ID
     * @return 未完成任务列表
     */
    List<Task> getIncompleteRoleTasks(long roleId);

    /**
     * 获取角色已完成的任务
     * @param roleId 角色 ID
     * @return 已完成任务列表
     */
    List<Task> getCompletedRoleTasks(long roleId);

    /**
     * 根据 ID 获取任务
     * @param taskId 任务 ID
     * @return 任务信息
     */
    Task getTaskById(long taskId);
    PageResult<Task> getAllTasks(int page, int pageSize);

    /**
     * 查询用户的未完成任务
     */
    List<Task> getIncompleteTasksByUserId(Long userId);

    /**
     * 查询用户的已完成任务
     */
    List<Task> getCompletedTasksByUserId(Long userId);



    void createPlayer(Player player);

    Player getPlayerByAccount(String account);

    Player getPlayerById(Long playerId);

    void updatePlayer(Player player);

    void createPlayerFeedback(PlayerFeedback feedback);

    List<PlayerFeedback> getPlayerFeedbacks(Long playerId);

    PageResult<PlayerFeedback> getUnprocessedFeedbacks(int page, int pageSize);

    void markFeedbackAsProcessed(Long feedbackId);
    PageResult<Player> getPlayerList(int page, int pageSize, String keyword);


    void deletePlayer(Long id);




    // 公会表相关
    void createGuild(Guild guild);
    Guild getGuildById(Long guildId);
    List<Guild> getAllGuilds();
    PageResult<Guild> getGuildsByPage(int page, int pageSize,String sortField, String sortOrder);
    void updateGuild(Guild guild);
    void deleteGuild(Long guildId);

    // 公会成员表相关
    void addGuildMember(GuildMember member);
    GuildMember getGuildMemberById(Long memberId);
    List<GuildMember> getGuildMembersByGuildId(Long guildId);
    void updateGuildMember(GuildMember member);
    void deleteGuildMember(Long memberId);
    void approveGuildMember(Long memberId);
    PageResult<GuildMember> getAllGuildMembers(int page, int pageSize);


    // 公会公告表相关
    void publishGuildNotice(GuildNotice notice);
    GuildNotice getGuildNoticeById(Long noticeId);
    List<GuildNotice> getGuildNoticesByGuildId(Long guildId);
    void updateGuildNotice(GuildNotice notice);
    void deleteGuildNotice(Long noticeId);

    PageResult<GuildNotice> getAllGuildNotices(int page, int pageSize);

    // 公会活动表相关
    void createGuildActivity(GuildActivity activity);
    GuildActivity getGuildActivityById(Long activityId);
    List<GuildActivity> getGuildActivitiesByGuildId(Long guildId);
    void updateGuildActivity(GuildActivity activity);
    void deleteGuildActivity(Long activityId);

    PageResult<GuildActivity> getAllGuildActivities(int page, int pageSize);

    // 公会活动参与表相关
    void addActivityParticipant(GuildActivityParticipant participant);
    List<GuildActivityParticipant> getParticipantsByActivityId(Long activityId);
    void removeActivityParticipant(Long participantId);
    List<GuildActivityParticipant> getAllActivityParticipants();


    // 公会贡献表相关
    void recordGuildContribution(GuildContribution contribution);
    List<GuildContribution> getContributionsByPlayerId(Long playerId);
    List<GuildContribution> getContributionsByGuildId(Long guildId);
    void updateGuildContribution(GuildContribution contribution);

    PageResult<GuildContribution> getAllGuildContributions(Integer page, Integer pageSize, String sort, String order);
    // 公会外交关系表相关
    void establishDiplomacy(GuildDiplomacy diplomacy);
    GuildDiplomacy getGuildDiplomacyById(Long diplomacyId);
    List<GuildDiplomacy> getDiplomaciesByGuildId(Long guildId);
    void updateGuildDiplomacy(GuildDiplomacy diplomacy);
    void terminateDiplomacy(Long diplomacyId);

    // 在Service接口中添加方法
    PageResult<GuildDiplomacy> getAllDiplomacies(int page, int pageSize, String sort, String order);
    // 公会聊天表相关
    void sendGuildChat(GuildChat chat);
    List<GuildChat> getChatsByGuildId(Long guildId);

}